#ifndef _FACTORY_H_
#define _FACTORY_H_

#include <iostream>

//Factory class
//abstract base class

class Product;

class Factory
{
public:
	virtual ~Factory(void) = 0;
	virtual Product* CreateProduct() = 0;
protected:
	Factory(void);
};

//ConcreteFactory class
//derive class of Factory class
class ConcreteFactory : public Factory
{
public:
	ConcreteFactory(void)
	{
		std::cout<<"Create concrete factory"<<std::endl;
	}

	~ConcreteFactory(void)
	{
		std::cout<<"Destroy concrete factory"<<std::endl;
	}

	template<class T>
	Product* CreateProduct(void)
	{
		return new T();
	}
};

#endif //~_FACTORY_H_
